import React, { Component } from 'react';
import BaseHeader from '@/components/base/baseHeader'
import './sousuo.scss';
class Com extends Component {
    constructor (props) {
      super(props)
      this.state = {
        namelist:[]
      }
    }
    componentWillMount(){
      this.state.name=this.props.location//传递过来的所有参数
      //console.log(this.props.location.state.key值)//val值
      // console.log(this.state.name)
      // console.log(JSON.stringify(this.state.name.yhsr))
      fetch(`http://poem.daxunxun.com:8000/api/juzi/searchName?name=${this.state.name.yhsr}`)
        .then(res => res.json())
        .then(data => {console.log(JSON.stringify(this.state.name.yhsr))
          console.log(data)
          this.setState({
            namelist:data
          })
        })
  }
                                    
    render () {
      return (
        <div>
          <BaseHeader />
          <div className="ssneirong">
            <div className="ssleft">
              {
                this.state.namelist.map((item,index)=>{
                  return(
                    <div>
                      <div className="sstop" key={index}>
                        <span></span>
                        <p>{item.name}</p>
                        <ul>
                          <li>诗文 / 作者 / 古籍</li>
                        </ul>
                      </div>
                      <div className = "zuozhejs"> 
                              <div className ="zzjstop" >
                                <img src={item.autorpictures} alt=""/>
                                <h2>{item.name}</h2>
                                <p>{item.autorIntroduce}</p>
                              </div>
                              <ul className="tool_img">
                                <li><i className="iconfont icon-shoucang"></i></li>
                                <li><i className="iconfont icon-copy"></i></li>
                                <li><i className="iconfont icon-xiaoxi"></i></li>
                              </ul>
                      </div>
                    </div>
                  )
                })
                
              }
              
            </div>
          </div>
        </div>
      )
    }
  }
  
  export default Com;